package com.rightsidetech.trade.dtos.request;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;

@Data
public class TdCommodityUserAppOrderRequest implements Serializable {

    @ApiModelProperty(value = "提货人/收货人名称",required = true)
    @Length(max = 20,message = "名称过长")
    @NotBlank(message = "名称不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9_!@%#&*?()（）\\s,.，。？“”·、+\\-\"=\\u4e00-\\u9fa5]{0,}$", message = "名称不能包含特殊字符")
    private String usName;

    @ApiModelProperty("随机数, 控制重复提交")
    @NotBlank(message = "随机数不能为空")
    @Length(max = 50,message = "随机数过长")
    private String requestId;

/*    @ApiModelProperty(value = "用户收货地址",required = true)
    @Length(max = 200,message = "用户收货地址过长")
    @NotBlank(message = "地址不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9_!@%#&*?()（）\\s,.，。？“”·、+\\-\"=\\u4e00-\\u9fa5]{0,}$", message = "收货地址不能包含特殊字符")
    private String usAddress;*/

    @ApiModelProperty(value = "手机号",required = true)
    @Length(max = 20,message = "请输入正确的手机号")
    @Pattern(regexp = "^1[0-9]{10}$",message = "请输入正确的手机号")
    private String usPhoneNo;

/*    @ApiModelProperty("经度")
    private BigDecimal longitude;

    @ApiModelProperty("纬度")
    private BigDecimal latitude;*/

    @ApiModelProperty(value = "地址id", required = true)
    private Long addressId;
    @ApiModelProperty(value = "邮寄地址id",required = false)
    private Long mailId;

    @ApiModelProperty(value = "门店id",required = true)
    @NotNull(message = "门店不能为空")
    private Long storeId;

    @ApiModelProperty("订单备注")
    @Length(max = 30,message = "订单备注过长")
    @Pattern(regexp = "^[a-zA-Z0-9_!@%#&*?()（）,.，。？“”·、+\\-\"=\\u4e00-\\u9fa5]{0,}$", message = "备注不能包含特殊字符")
    private String remarks;

    @ApiModelProperty(value = "订单类型, 0-上门服务, 1-到店自取",required = true)
    @Range(min = 0, max = 1, message = "订单类型不正确")
    @NotNull(message = "订单类型不能为空")
    private Byte orderType;

    @ApiModelProperty("0-非购物车, 1-购物车")
    @Range(min = 0,max = 1,message = "购物车状态不正确")
    @NotNull(message = "购物车状态不能为空")
    private Byte isBuyCar;

    @ApiModelProperty(value = "商品列表",required = true)
    private List<TdCommodityUserAppOrderDetailRequest> list;

    @ApiModelProperty(value = "交易类型: 0-小程序, 1-app",required = true)
    @Range(min = 0, max = 1, message = "交易类型不正确")
    @NotNull(message = "交易类型不能为空")
    private Byte tradeType;

    @ApiModelProperty(value = "小程序微信唯一标识ID",required = true)
    @NotBlank(message = "openid不能为空")
    private String openId;

    @ApiModelProperty(value = "优惠券编号")
    @Length(max = 30,message = "优惠券编号过长")
    private String code;

    @ApiModelProperty("(暂时)测试下单,null-真实, 1-测试")
    @Pattern(regexp = "^1$",message = "下单状态不正确")
    private String testFlag;

}
